package com.scqzy.shengchunqiang.sword2offer.day22;

import java.util.Arrays;

/**
 * @Description: 剑指 Offer 56 - I. 数组中数字出现的次数
 * @Author 盛春强
 * @Date 2021/8/29 23:09
 */
public class SingleNumbers {
    public int[] singleNumbers(int[] nums) {
        int[] bucket = new int[10001];
        for (int num : nums) {
            bucket[num]++;
        }
        int[] res = new int[10000];
        int p = 0;
        for (int i = 0; i < bucket.length; i++) {
            if (bucket[i] == 1) {
                res[p++] = i;
            }
        }
        return Arrays.copyOfRange(res,0,p);
    }
}
